"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MJHeapCardInfo = void 0;
class MJHeapCardInfo {
    static getChairByTouzi(touzi1, touzi2, seatNum, bankerChair) {
        let touziChair = (touzi1 + touzi2 - 1) % seatNum;
        touziChair = (touziChair + (1 - bankerChair) + seatNum) % seatNum;
        return touziChair;
    }
    static mopai(headCardInfo, mopaiChair, needNum) {
        let nowMochair = mopaiChair;
        do {
            let headInfo = headCardInfo[nowMochair];
            // Logger.log("mopai===", headCardInfo,nowMochair,needNum )
            let leftNum = headInfo.AllCount - headInfo.HeadUsedCount - headInfo.TailUsedCount;
            if (leftNum > needNum) {
                if (nowMochair == mopaiChair) {
                    headInfo.TailUsedCount += needNum;
                }
                else {
                    headInfo.HeadUsedCount += needNum;
                }
                needNum = 0;
            }
            else {
                if (nowMochair == mopaiChair) {
                    headInfo.TailUsedCount += leftNum;
                }
                else {
                    headInfo.HeadUsedCount += leftNum;
                }
                needNum -= leftNum;
                nowMochair = nowMochair - 1;
                if (nowMochair < 0) {
                    nowMochair = 3;
                }
            }
        } while (needNum > 0);
    }
}
exports.MJHeapCardInfo = MJHeapCardInfo;
